codegen: surface batch validation errors #1924
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a result of #1841 (letting named params contribute to param count), the call to
ParamRef
will actually fail for queries with mixed usage of numbered and named parameters.This PR mainly ensures that when the failure occurs, the error surfaced to the user makes it obvious what the issue is. Previously, the error would say
:batch* commands require parameters
when the actual error is that the parameters are being mixed.Now it says
path/to/query.sql:1:1: could not determine data type of parameter $1
orpath/to/query.sql:15:1: can not mix $1 format with ? format
With this change, I believe mixed parameters are still allowed for non-batch queries, and I'm not sure if I should change that (please let me know through review).
#1625